import { mapGetters, mapState, mapMutations } from "vuex";
import varCss from '@/uni.scss';
// const mixin = {

// }
export default {
    install(Vue) {
        Vue.mixin({
            data() {
                return {
                    var: varCss,
                };
            },
            computed: {
                navHeight() {
                    return uni.getStorageSync("navHeight");
                },
                isLogin() {
                    return this.$store.getters.token;
                },
                //是否是企业微信
                isQyWx() {
                    uni.setStorageSync("isQyWx", !!this.environment);
                    return !!this.environment;
                },
            },
            methods: {
                // 获取当前页面options参数
                getOptions() {
                    // 获取页面参数
                    const vm = getCurrentPages()[getCurrentPages().length - 1]; //当前页面实例
                    return vm.options;
                },
                // 获取上一页页面实例
                beforeVm(page = 1) {
                    return getCurrentPages()[getCurrentPages().length - (page + 1)].$vm; //获取上一页页面实例
                },
                // 获取当前页面实例
                getVm() {
                    return getCurrentPages()[getCurrentPages().length - 1].$vm; //当前页面实例
                },
            },
        });
    },
};